<!--XOA LOAI CO-->
<?php
if (isset($_GET['remove']))
{
    $kieucoid = $_GET ['kieucoid'];
    $result = mysql_query("DELETE FROM kieuco where kieucoid = $kieucoid; ");
    if ($result)
        print '<h2>Xóa thành công !</h2>';
}
?>

<!--FORM THEM LOAI CO-->
<form action="index.php?sanxuat&module=kieuco" method="post" enctype="multipart/form-data">
<fieldset>
<legend><h1>Thêm mới loại cổ</h1></legend>
<table width="408" border="0">
  <tr>
    <td width="74">Loại cổ</td>
    <td width="318"><label>
      <input type="text" name="loaico" id="textfield" />
    </label></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value="Thêm" /></td>
  </tr>
</table>
</fieldset>
</form>

<!--PHP THEM LOAI CO-->
<?php
if (isset($_POST['submit']))
{
    //print_r ($_POST);
    $loaico    =   $_POST['loaico'];
    $mysql = "insert into kieuco (loaico) values ('$loaico')";
    $result = mysql_query($mysql);
    if ($result)
        print '<h2>Thành công !</h2>';
}
?>

<!--HIEN THI CAC LOAI CO-->
<fieldset>
<legend><h1>Các loại cổ :</h1></legend>
<table width="695" border="0">
    <tr>
        <td width="100"><b>ID</b></td>
        <td width="300"><b>Loại cổ</b></td>
        <td width="200"><b>Xóa</b></td>
    </tr>

    <?php
        $kieuco = mysql_query("select * from `kieuco`");
        while ($row = mysql_fetch_array($kieuco))
        {
    ?>
    <tr>
        <td width="100"><?php print "$row[kieucoid]"; ?> </td>
        <td width="200"><?php print "$row[loaico]"; ?> </td>
        <td width="200">
        <a href="index.php?sanxuat&module=kieuco&kieucoid=<?php print "$row[kieucoid]"; ?>&remove" onclick="return confirm('Muốn xóa thật ko?')" >Xóa</a
        </td>
    </tr>
    <?php 
        }
    ?>
</table>
</fieldset>
